<template>
  <div>
    <van-checkbox style="margin: 10px;margin-left: 12px;background-color: rgba(white, white, white, 0.2);"
      v-model="flag" @click="isSelectAll(flag)">全选</van-checkbox>
  </div>
</template>

<script>
import { updateSelectAll, lookCartlist } from '@/apis/cart';
export default {
  data() {
    return {
      flag: true
    }
  },
  methods: {
    isSelectAll(flag) {
      updateSelectAll({ userid: localStorage.getItem("userid"), type: flag }).then(res => {
        console.log(res);

        lookCartlist({ userid: localStorage.getItem("userid") }).then(res => {
          this.cartlist = res.data.data || []
          console.log(this.cartlist);
        })
      })
    }
  }
}
</script>

<style lang="less" scoped></style>